package com.kotlin.heimaplayer.widget

import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.RelativeLayout
import com.kotlin.heimaplayer.R
import com.kotlin.heimaplayer.model.YueDanItemBean
import com.squareup.picasso.Picasso
import jp.wasabeef.picasso.transformations.CropCircleTransformation
import kotlinx.android.synthetic.main.item_yuedan.view.*

/**
 * 悦单每个条目的自定义view
 */

class YueDanItemView : RelativeLayout {
    // 条目view 的初始化
    fun setData(data:YueDanItemBean) {
        title.text = data.title
        Picasso.get().load(data.picurl).into(bg)
        Picasso.get().load(data.singers[0].picurl).transform(CropCircleTransformation()).into(author_image)
    }

    constructor(context: Context?) : super(context)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context,
        attrs,
        defStyleAttr
    )
    init {
        View.inflate(context, R.layout.item_yuedan,this)
    }
}